#include <iostream>
#include <mimetic/mimetic.h>

using namespace std;
using namespace mimetic;

int main()
{
  MimeEntity me;
  me.header().from("me <me@domain.com>");
  me.header().to("you <you@domain.com>");
  me.header().subject("my first mimetic msg");
  me.body().assign("hello there!");
  cout << me << endl;

  Base64::Encoder b64(0);                  // encodes in Base64
  MaxLineLen mll(40);                      // inserts a newline every 40 chars
  //ToUpperCase tup;                       // convert text to upper case
  enum { sz = 2048 };
  char source[sz], dest[2*sz];
  snprintf(source, sz, "%s", "hellow LIU");
  encode(source, source + strlen(source), b64 | mll, dest);  // encode
  cout << dest <<endl;
  char xxx[sz] = {0};

  Base64::Decoder x64;
  encode(dest, dest + strlen(dest), x64 , xxx);
  cout << xxx << endl;
  return 0;
}
